package com;

import java.util.function.Supplier;

/**
 * 供应接口，不知道干嘛用的
 * 用来生成类 构造器
 */
public class SupplierOne {
    public static <T> T  add(String name){
        Supplier<String> supplier = ()->{
            return "你是我"+name;
        };
        return (T)supplier.get();
    }



    /**
     * 生女儿
     * @param
     * @param <T>
     * @return
     */
    public static <T> T girl(){
        Supplier<Girl> supplier = new Supplier<Girl>() {
            @Override
            public Girl get() {
                Girl girl = new Girl("小花",18);

                return girl;
            }
        };
        Supplier<Girl> girlSupplier = ()->{
            Girl girl = new Girl("小花",18);

            return girl;
        };
        Supplier<Girl> girlSupplier1 = Girl::new;


        return (T)supplier.get();
    }

    public static void main(String[] args) {
        String name  = "儿子";
        System.out.println((String)add(name));
        System.out.println((Girl)girl());
    }
}
